﻿
using HBKY.Shop.Common.Helper;
using MongoDB.Driver;

namespace HBKY.Shop.Repository.MongoRepository
{

    public class MongoDbContext
    {
        private readonly IMongoDatabase _database = null;

        public MongoDbContext()
        {
            var client = new MongoClient(Appsettings.Option(new string[] { "Mongo", "ConnectionString" }));
            if (client != null)
                _database = client.GetDatabase(Appsettings.Option(new string[] { "Mongo", "Database" }));
        }

        public IMongoDatabase Db
        {
            get { return _database; }
        }
    }
}
